<%@page import="auxilary.Links"%>
<%@page import="auxilary.Actions"%>
<%@page import="entities.User"%>
<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<%
	User user = (User)request.getSession().getAttribute("user"); 
%>
<jsp:include page="/frames/start.jsp" />
	<%=Links.Css.PROFILE %>
	<%=Links.Scripts.PROFILE %>
<jsp:include page="/frames/frame.jsp" />
			<h1><%=user.getUsername() %>'s profile</h1>
			<br />
			<div class="profile<% if (user.isAdmin()) { %> admin-profile<% } %>">
				<div class="row">
					<div class="left">First Name:</div>
					<form class="right" action="javascript:enter('<%=Actions.User.CHANGE_FIRST_NAME %>')">
						<input class="field" id="field-<%=Actions.User.CHANGE_FIRST_NAME %>" type="text" value="<%=user.getFirstName() %>"/>
						<small id="field-<%=Actions.User.CHANGE_FIRST_NAME %>-error" class="error"></small>
					</form>
				</div>
				<div class="row">
					<div class="left">Last Name:</div>
					<form class="right" action="javascript:enter('<%=Actions.User.CHANGE_LAST_NAME %>')">
						<input class="field" id="field-<%=Actions.User.CHANGE_LAST_NAME %>" type="text" value="<%=user.getLastName() %>"/>
						<small id="field-<%=Actions.User.CHANGE_LAST_NAME %>-error" class="error"></small>
					</form>
				</div>
				<hr />
				<div class="row">
					<div class="left">E-Mail:</div>
					<form class="right" action="javascript:enter('<%=Actions.User.CHANGE_EMAIL %>')">
						<input class="field" id="field-<%=Actions.User.CHANGE_EMAIL %>" type="text" value="<%=user.getEmail() %>"/>
						<small id="field-<%=Actions.User.CHANGE_EMAIL %>-error" class="error"></small>
					</form>
				</div>
				<div class="row">
					<div class="left">Phone:</div>
					<form class="right" action="javascript:enter('<%=Actions.User.CHANGE_PHONE %>')">
						<input class="field" id="field-<%=Actions.User.CHANGE_PHONE %>" type="text" value="<%=user.getPhone() %>"/>
						<small id="field-<%=Actions.User.CHANGE_PHONE %>-error" class="error"></small>
					</form>
				</div>
				<div class="row">
					<div class="left">Password:</div>
					<div class="right"><input type="button" value="Change Password" onclick="togglePasswordBox()"/></div>
				</div>
				<hr />
				<div class="row">
					<div class="left">Faculty:</div>
					<form class="right" action="javascript:enter('<%=Actions.User.CHANGE_FACULTY %>')">
						<input class="field" id="field-<%=Actions.User.CHANGE_FACULTY %>" type="text" value="<%=user.getFaculty() %>"/>
						<small id="field-<%=Actions.User.CHANGE_FACULTY %>-error" class="error"></small>
					</form>
				</div>
				<div class="row">
					<div class="left">Semester:</div>
					<form class="right" action="javascript:enter('<%=Actions.User.CHANGE_SEMESTER %>')">
						<input class="field" id="field-<%=Actions.User.CHANGE_SEMESTER %>"  type="text" value="<%=user.getSemester() %>" />
						<small id="field-<%=Actions.User.CHANGE_SEMESTER %>-error" class="error"></small>
					</form>
				</div>
			   	<form class="password-change" action="javascript:changePassword()">
			   		<div class="box">
				   		Current Password:
				   		<input class="password-field" id="field-old-password" type="password" name="oldPassword" />
				   		New Password:
				   		<input class="password-field" id="field-new-password" type="password" name="value" />
				   		Re-enter Password:
				   		<input class="password-field" id="field-re-password" type="password" />
				   		<input type="hidden" name="action" value="<%=Actions.User.CHANGE_PASSWORD %>" />
				   		<center id="password-error" class="error"></center>
				   		<input type="submit" value="Submit" />
				   		<input type="button" value="Cancel" onClick="togglePasswordBox()"/>
				   	</div>
				</form>
			</div>
<jsp:include page="/frames/end.jsp" />